$(() => {
    let xmlhttp;
    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest;
    } else {
        xmlhttp = new ActiveXObject("Microsofet.XMLHTTP");
    }
    xmlhttp.onreadystatechange = () => {
        if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
            let user = JSON.parse(xmlhttp.responseText);
            let msg = user[0];
            let sex = '';
            if (msg.gender) {
                sex = "男";
            } else {
                sex = "女";
            }
            let str = `我是${msg.user_name}`;
            let ava = $("#ava").attr("src", msg.avatar);
            /*       console.log('ava: ', ava);
                  console.log($("#ava"));
                  console.log(document.getElementById('ava')); */
            $('#uname').text(msg.uname);
            $('#user_name').text(str);
            $('#phone').text(msg.phone);
            $('#gender').text(sex);
            $('#email').text(msg.email);
            $('#picture').text(msg.avatar);
            $('#uid').text(msg.uid);
        }
    };
    let url = "http://127.0.0.1:8080/v1/users/find" + location.search;
    xmlhttp.open('GET', url, true);
    xmlhttp.send();
});